<!DOCTYPE html>
<html>
<head>
<include file="Include:meta" />
<title>{$con}-目的地运营集团数据管理平台</title>
<include file="Include:style" />
<style>
	.folder span{ display: inline-block; margin: 0 40px 0 1px; }
</style>
</head>
<body>
<include file="Include:header" />
<include file="Include:left" />
<div id="main">
	<div class="crumbs">
		<div class="crumbs-text">{$con}</div>
	</div>
	<div id="content">
		<if condition="$action eq 'share' and $id eq NULL">
		<div class="filter">
			<div>
				<div class="filter-title">类型</div>
				<ul class="filter-order">
					<li <if condition="$typ eq 1">class="current"</if>>
						<a href="__APP__/Index/index_more/action/share/typ/1">分享文件</a>
					</li>
					<li <if condition="$typ eq 2">class="current"</if>>
						<a href="__APP__/Index/index_more/action/share/typ/2/rstatus/{$rstatus}">被分享文件</a>
					</li>
					<li>
						<a href="__APP__/System/message_list/status/-1">提醒 <if condition="$al_ct gt 0">({$al_ct})</if></a>
					</li>
				</ul>
			</div>
		</div>
		</if>
		<div class="table-scrollx">
			<table class="table table-bordered table-hover">
				<if condition="$action eq 'share'">
					<tr class="table-header fixed-table-header">
						<td width="">标题</td>
						<td width="">库名</td>
						<td width=""><if condition="$typ eq 1">分享日期<else/>分享人(日期)</if></td>
						<td width="">
							<if condition="$typ eq 1">
								分享人
							<else/>
								<if condition="$id eq NULL">
									<select name="rstatus" class="form-control w90">
										<option value="-10"<if condition="$rstatus eq -10"> selected</if>>状态</option>
										<option value="-1"<if condition="-1 eq $rstatus"> selected</if>>未读</option>
										<option value="1"<if condition="1 eq $rstatus"> selected</if>>已读</option>
									</select>
								<else/>
									状态
								</if>
							</if>
						</td>
						<if condition="$typ eq 1">
							<td>管理</td>
						</if>
					</tr>
					<if condition="$result eq NULL">
					<tr><td class="Text_c" <if condition="$typ eq 1">colspan="5"<else/>colspan="4"</if>>暂无相关数据</td></tr>
					</if>
					<foreach name="result" item="vo">
						<tr>
							<td>
								<if condition="$vo['folder_name'] neq NULL">
									<if condition="$vo['folder_name'] eq NULL">{$vo['name']}<else/>{$vo['folder_name']}</if><a class="arrow ml10" href="javascript:;"><i class="glyphicon glyphicon-chevron-down"></i></a>
								<else/>
									<if condition="$action neq 'share'">
										<a href="__APP__/Index/library_detail/id/{$vo['id']}/classif/{$vo['classif']}/type/{$vo['type']}/go/1">{$vo['name']}</a>
									<else/>
										<a href="__APP__/Index/library_detail/id/{$vo['mid']}/sid/{$vo['id']}/classif/{$vo['classif']}/type/{$vo['folder_type']}/go/1">{$vo['name']}</a>
									</if>
								</if>
							</td>
							<td>{$vo['type_name']}</td>
							<td><if condition="$typ eq 1">{$vo['add_date']|substr=0,10}<else/>{$vo['add_user']}({$vo['add_date']|substr=0,10})</if></td>
							<td>
								<if condition="$typ eq 1">
									<a href="javascript:;" class="yes" mid="{$vo['id']}" types="1">已读</a>
									<a href="javascript:;" class="no" mid="{$vo['id']}" types="-1">未读</a>
								<else/>
									<if condition="$vo['rsta'] eq 1">
										已读
									<else/>
										未读
									</if>
								</if>
							</td>
							<if condition="$typ eq 1">
								<td>
									<if condition="$vo['folder_name'] eq NULL">
										<a href="javascript:;" zid="{$vo['id']}" action="fx_down" data-toggle="tooltip" data-placement="left" title="放弃分享" class="fx_down"><i class="fa fa-reply"></i></a>
									<else/>
										<a href="javascript:;" zid="{$vo['id']}" action="fx_down" data-toggle="tooltip" data-placement="left" title="放弃分享" class="fx_down2"><i class="fa fa-reply"></i></a>
									</if>
								</td>
							</if>
						</tr>
						<if condition="$vo['folder_name'] neq NULL">
							<tr class="hide">
								<td colspan="4" class="folder">
									<foreach name="vo['detail']" item="do">
										<a href="__APP__/Index/library_detail/id/{$do['id']}/sid/{$vo['id']}/classif/{$do['classif']}/type/{$do['type']}/go/1">{$do['name']}</a>
										<if condition="$typ eq 2"><if condition="$do['rsta'] eq 1"><span></span><else/><span>未读</span></if><else/><span></span></if>
									</foreach>
								</td>
							</tr>
						</if>
					</foreach>
				<else/>
					<tr class="table-header fixed-table-header">
						<td width="">标题</td>
						<td width="">库名</td>
						<td width="">日期</td>
						<if condition="$action eq 'collection'">
							<td width="">管理</td>
						</if>
					</tr>
					<foreach name="result" item="vo">
						<tr>
							<td>
								<if condition="$vo['folder_name'] neq NULL">
									<if condition="$vo['folder_name'] eq NULL">{$vo['name']}<else/>{$vo['folder_name']}</if><a class="arrow ml10" href="javascript:;"><i class="glyphicon glyphicon-chevron-down"></i></a>
								<else/>
									<if condition="$action neq 'share'">
										<a href="__APP__/Index/library_detail/id/{$vo['id']}/classif/{$vo['classif']}/type/{$vo['type']}/go/1">{$vo['name']}</a>
									<else/>
										<a href="__APP__/Index/library_detail/id/{$vo['mid']}/sid/{$vo['id']}/classif/{$vo['classif']}/type/{$vo['folder_type']}/go/1">{$vo['name']}</a>
									</if>
								</if>
							</td>
							<td>{$vo['type_name']}</td>
							<td>{$vo['add_date']|substr=0,10}</td>
							<if condition="$action eq 'collection'">
								<td width="">
									<a href="javascript:;" zid="{$vo['id']}" action="collection" data-toggle="tooltip" data-placement="left" title="取消收藏" class="collection"><i class="glyphicon glyphicon-star"></i></a>
								</td>
							</if>
						</tr>
					</foreach>
				</if>
			</table>
		</div>
	</div>
</div>
<!--详情-->
<div id="detailModal" class="modal hide fade">
	<div class="modal-dialog w500">
		<div class="modal-content">
			<div class="modal-header">
				<h4 id="myModalLabel">已读详情</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body"></div>
		</div>
	</div>
</div>
<div id="detailModaln" class="modal hide fade">
	<div class="modal-dialog w500">
		<div class="modal-content">
			<div class="modal-header">
				<h4 id="myModalLabel">未读详情</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body"></div>
		</div>
	</div>
</div>
<include file="Include:javascript" />
<script type="text/javascript">
$(function(){
	//放弃分享
	$(".fx_down").ajaxModal({"title_text":"确认提示框","body_text":"您确定要放弃分享吗？","url":"__APP__/Index/library_ajax","data":{"id":"zid","action":"action"}});
	$(".fx_down2").ajaxModal({"title_text":"确认提示框","body_text":"您确定要取消分享吗？","url":"__APP__/Index/sz_audit","data":{"id":"zid","action":"action"}});
	$('.arrow').click(function(){
		if($(this).parents('tr').hasClass('active')){
			$(this).parents('tr').removeClass('active').next('tr').hide();
			$(this).find('i').removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down');
		}else{
			$(this).parents('tr').addClass('active').next('tr').show();
			$(this).find('i').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up');
		}
	})
	
	$(document).on("change","[name='rstatus']",function(){
		var val = $(this).val();
		window.location.href="__APP__/Index/index_more/action/share/typ/2/rstatus/"+val;
	});
	
	$(".yes").on("click",function(){
		var mid = $(this).attr("mid"),
			types = $(this).attr("types");
		$.ajax({
			type:"POST",
			async:false,
			dataType:"json",
			data:{"id":mid,"types":types,"action":"types"},
			url:"__APP__/Index/library_ajax",
			success:function(data){
				var html = "<table class='table table-bordered'>";
					html += "<tr  class='table-header'><td>人员</td><td>时间</td></tr>";
				if(data){
					for(var i=0;i<data.length;i++){
						html += "<tr>";
						html += "<td>"+data[i].add_user+"</td>";
						html += "<td>"+data[i].add_date+"</td>";
						html += "</tr>";
					}
				}else{
					html += "<tr>";
					html += "<td colspan='2' class='Text_c'>暂无人员</td>";
					html += "</tr>";
				}
				
				html+="</table>";
				$("#detailModal").find(".modal-body").html(html).end().modal();
			}
		});
	});
	
	$(".no").on("click",function(){
		var mid = $(this).attr("mid"),
			types = $(this).attr("types");
		$.ajax({
			type:"POST",
			async:false,
			dataType:"json",
			data:{"id":mid,"types":types,"action":"types"},
			url:"__APP__/Index/library_ajax",
			success:function(data){
				var html = "<table class='table table-bordered'>";
					html += "<tr  class='table-header'><td>人员</td></tr>";
					html += "<tr>";
					if(data){
						html += "<td>"+data+"</td>";
					}else{
						html += "<td colspan='2' class='Text_c'>暂无人员</td>";
					}
					html += "</tr>";
				html+="</table>";
				$("#detailModaln").find(".modal-body").html(html).end().modal();
			}
		});
	});
	//收藏
	$('.collection').on("click",function(){
		var $zid = $(this).attr("zid");
		$.ajax({
			type:"POST",
			async:false,
			dataType:"json",
			data:{"id":$zid,"action":"collection"},
			url:"__APP__/Index/library_ajax",
			success:function(data){
				success_pop(data['status'],data['msg']);
			}
		});
	});
});
</script>
</body>
</html>